use "Analysis Data/tableC8_data.dta", clear
bys state_name ac_num: egen voteshare_vb_csds = mean(100*voted_votebuyer)
bys state_name ac_num: drop if _n>1

merge 1:1 state ac_num using "Analysis Data/table1_3_data.dta", nogen keep(matched) keepusing(poll_date? treat wgt_treat voteshare_vb_2014 station_id?)

replace station_id2 = -1*_n if station_id2==-9
replace station_id3 = -1000*_n if station_id3==-9

eststo clear
 
eststo: clus_nway reg voteshare_vb_2014 poll_date? treat [aweight=wgt_treat], cluster(station_id1 station_id2 station_id3)

eststo: clus_nway reg voteshare_vb_csds poll_date? treat [aweight=wgt_treat], cluster(station_id1 station_id2 station_id3)

esttab, keep(treat) wrap cells(b(fmt(2)) se(par fmt(2)) p(fmt(2)))collabel(none) label stats(r2 N, fmt(2 0) labels("$R^2$" "Obs."))
